package com.bluejazz.controller;

import com.bluejazz.annotation.ResponseResult;
import com.bluejazz.application.dto.SalarySlipDTO;
import com.bluejazz.validator.SalaryValidator;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@RestController
@RequestMapping("salaries")
@ResponseResult
public class SalaryController {

    @InitBinder
    public void initBinder(WebDataBinder binder) {
        binder.setValidator(new SalaryValidator());
    }

    @PostMapping("/salary-slip:save")
    public String saveSalary(@Valid @RequestBody SalarySlipDTO salarySlipDTO) {
        return "All Right";
    }
}
